import request from '@/utils/request'

// 查询订单主表列表
export function listOrder(query) {
  return request({
    url: '/shop/order/list',
    method: 'get',
    params: query
  })
}

// 查询订单主表详细
export function getOrder(id) {
  return request({
    url: '/shop/order/' + id,
    method: 'get'
  })
}

// 新增订单主表
export function addOrder(data) {
  return request({
    url: '/shop/order',
    method: 'post',
    data: data
  })
}

// 修改订单主表
export function updateOrder(data) {
  return request({
    url: '/shop/order',
    method: 'put',
    data: data
  })
}

// 删除订单主表
export function delOrder(id) {
  return request({
    url: '/shop/order/' + id,
    method: 'delete'
  })
}

// 修改订单主表
export function updatePay(data) {
  return request({
    url: '/shop/order/exitPay',
    method: 'put',
    data: data
  })
}

// 关闭订单
export function closeOrder(obj) {
  return request({
    url: '/shop/order/close',
    method: 'put',
    params: obj
  })
}

// 手动退款
export function refundAmount(data) {
  return request({
    url: '/shop/order/refundAmount',
    method: 'put',
    data: data
  })
}

// 取消订单
export function cancelOrder(obj) {
  return request({
    url: '/shop/order/cancelOrder',
    method: 'put',
    params: obj
  })
}

// 订单同步
export function activeStatus(data) {
  return request({
    url: '/shop/order/active/status',
    method: 'post',
    data,
  });
}